<?php

/**
 * LineaVenta form.
 *
 * @package    administracion-ventas
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class LineaVentaForm extends BaseLineaVentaForm
{
    public function configure()
    {
        sfContext::getInstance()->getConfiguration()->loadHelpers(array('Form', 'Javascript', 'Url'));
        $this->widgetSchema['producto_id'] =  new sfWidgetFormPropelChoice(array('renderer_class' => 'sfWidgetFormPropelJQueryAutocompleter', 'model' => 'Producto',
              'renderer_options' => array(
          'model' => 'Producto', 'url' => $this->getOption('url'))));
          $this->widgetSchema['producto_id']->setAttribute('onBlur', remote_function(array('url' => '@getProductPrice', 'with' => "'id='+getProductId(this)+'&fila='+getProductRow(this)", 'update' => "precio_'+getProductRow(this)+'_producto", 'script' => true)));
        $this->widgetSchema['cantidad']->setAttribute('size', '3');
        $this->widgetSchema['porcentaje_descuento']->setAttributes(array('size' => '3', 'maxlength' => '3'));
        $this->widgetSchema['porcentaje_descuento']->setLabel('Descuento');
        $this->widgetSchema['precio_producto']->setLabel('Precio');
        $this->widgetSchema['precio_producto']->setAttributes(array('size' => '5', 'maxlength' => '7', 'readonly' => true));
        $this->widgetSchema['producto_id']->setLabel('Producto');

        $this->validatorSchema['producto_id'] = new sfValidatorString();
    }
}
